<?php
if ($POST->categoria->slug == 'about-me') $html = str_replace('${postMeta}', 'hide', $html);
$html = str_replace('${titulo}', $POST->titulo, $html);
$html = str_replace('${timeago}', $POST->created_at, $html);
$html = str_replace('${fecha}', strftime ('%d de %B a las %H:%M hs', strtotime($POST->created_at)), $html);
$html = str_replace('${categoriaSlug}', $POST->categoria->slug, $html);
$html = str_replace('${categoriaValue}', $POST->categoria->value, $html);
$html = str_replace('${contenido}', $POST->contenido, $html);
$html = str_replace('${tags}', $tags, $html);

//slider
$thumb='';
$imagenes = $POST->sortedImages();
if (count($imagenes))  {
    $slideItems = '';
    foreach ($imagenes as $slideItem) {
        if ($slideItem['is_video']) {
            $slideItems .= '<div class="item-video"><a class="owl-video" href="'.$slideItem['url'].'"></a></div>';
        } else {
            if ($thumb=='') $thumb = 'content/images/'.$slideItem['src'];
            $slideItems .= '<div class="item"><img src="content/images/'.$slideItem['src'].'" /></div>';
        }
    }
    $html = str_replace('${slider}', $slideItems, $html);
} else {
    str_replace('${postImg}', 'hide', $html);
}

//social
$html = str_replace('${url}', urlencode(URL.'post/'.$POST->slug), $html);
$html = str_replace('${descripcion}', urlencode($POST->titulo), $html);
$html = str_replace('${thumb}', urlencode(URL.$thumb), $html);

$html = preg_replace('/\${*[A-Za-z0-9_]*\}*/', '', $html);
?>
